<extend name="layout/main" />

<block name="HEADER">

</block>

<block name="CONTENT">
	<control:grid id="grid" />

</block>

<block name="FOOTER">
	<script type="text/javascript">
        var page = (function(ns){

            //页面初始化
            ns.init=function(){

            }

            //新增
            ns.add = function(){
                var filter = {
                    url:$.getModule('edit'),
                    mode:1,
                }

                $.openIframe(filter,'新增',['500px','520px']);

            }

            //编辑
            ns.edit=function(){
               var selectedRow = grid.getSelectedRows()[0];
               if(!selectedRow){
                    $.toast(0,'请选择数据！');
                    return false;
               }
               var filter = {
                 url:$.getModule('edit'),
                 oid:selectedRow[grid.option.key],
                 mode:2
               }
               $.openIframe(filter,'编辑',['500px','520px']);
			}

            //删除
            ns.del =function(){
                grid.deleteSelectRow(true);
            }

            return ns;
        }({}));


        $(function(){ page.init();  });

	</script>
</block>